<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Mihail Merkov
 * Date: 13-8-11
 * Time: 8:08
 * To change this template use File | Settings | File Templates.
 */

namespace TennisTournament\Service;

use TennisTournament\Model\Group;

interface GroupService extends GenericService {

    const MIN_PLAYER_IN_GROUP = 2;

    const ELIGIBLE_NUMBER_GROUPS_ONE = 1;

    const ELIGIBLE_NUMBER_GROUPS_TWO = 2;

    const ELIGIBLE_NUMBER_GROUPS_FOUR = 4;

    const ELIGIBLE_NUMBER_GROUPS_EIGHT = 8;

    const PLAYERS_CONTINUE_TOURNAMENT = 2;

    /**
     * Convert Group to JSON object
     * @param Group $group
     * @return string
     */
    public function toJSON(Group $group);

    /**
     * Get all groups
     * @return array
     */
    public function listAll();

    /*
     * Get all groups with sorted {@link GroupStats} into there.</br>
     * First will be sort the {@Player} with most points.</br>
     * After this will be sort the {@Player} with most positive difference,
     * between takenPoints and getPoints.
     * @param $collectionGroup array optional parameter
     * if is not defined will set the array from listAll() for $collectionGroups
     * @return array
     */
    public function getAllGroupsSorted(array $collectionGroups = array());

    /**
     * Return, whether the number of groups are eligible for tournament logic
     * @param $intNumberGroups integer
     * @return boolean
     */
    public function isEligibleNumberOfGroups($intNumberGroups);
}